home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / circuits / spice2g6.z / spice2g6 / spice / Fortran / magphs.f < prev    next >
Encoding:
Text File  |  1989-02-03  |  680 b   |  24 lines

  1.       subroutine magphs(cvar,xmag,xphs)
  2.       implicit double precision (a-h,o-z)
  3. c
  4. c     this routine computes the magnitude and phase of its complex arg-
  5. c ument cvar, storing the results in xmag and xphs.
  6. c
  7. c spice version 2g.6  sccsid=knstnt 3/15/83
  8.       common /knstnt/ twopi,xlog2,xlog10,root2,rad,boltz,charge,ctok,
  9.      1   gmin,reltol,abstol,vntol,trtol,chgtol,eps0,epssil,epsox,
  10.      2   pivtol,pivrel
  11.       complex cvar
  12. c
  13. c
  14.       xreal=dble(real(cvar))
  15.       ximag=dble(aimag(cvar))
  16.       xmag=dsqrt(xreal*xreal+ximag*ximag)
  17.       if (xmag.ge.1.0d-20) go to 10
  18.       xmag=1.0d-20
  19.       xphs=0.0d0
  20.       return
  21.    10 xphs=rad*datan2(ximag,xreal)
  22.       return
  23.       end
  24.